package com.fifth.commodity.controller;

import com.fifth.commodity.service.DepositService;
import com.fifth.commodity.vo.BrandVo;
import com.fifth.commodity.vo.DepositStatusVo;
import com.fifth.commodity.vo.DepositVo;
import com.fifth.commodity.vo.StatusVo;
import com.fifth.common.pojo.dto.CommonResult;
import com.fifth.common.pojo.entity.Deposit;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("commodity/deposit")
public class DepositController {
    @Autowired
    private DepositService depositService;

    /**
     * 根据条件分页查询所有储藏方式信息
      * @param pageCurrent
     * @param pageSize
     * @param depositVo
     * @return
     */
    @PostMapping("findDepositByCondition/{pageCurrent}/{pageSize}")
    public CommonResult findDepositCondititon(@PathVariable Integer pageCurrent, @PathVariable Integer pageSize, @RequestBody DepositVo depositVo){
        return depositService.findDepositCondition(pageCurrent,pageSize,depositVo);
    }

    /**
     * 查询所有储藏方式
     * @return
     */
    @ApiOperation("查询所有储藏方式")
    @PostMapping("findAllDeposit")
    public CommonResult findAllDeposit(){
        return depositService.findAllDeposit();
    }

    /**
     * 根据id删除储藏类型
     * @param id
     * @return
     */
    @ApiOperation("根据id删除储藏类型")
    @ApiImplicitParam(dataType = "int",name = "id",value = "储藏类型的id")
    @PostMapping("deleteDeposit")
    public CommonResult deleteDeposit(Integer id){
        return depositService.deleteDeposit(id);
    }

    /**
     * 修改审核状态
     * @param depositStatusVo
     * @return
     */
    @ApiOperation("修改审核状态")
    @ApiImplicitParam(dataType = "DepositStatusVo",name = "depositStatusVo",value = "接收审核的实体类")
    @PostMapping("updateStatus")
    public CommonResult updateStatus(@RequestBody DepositStatusVo depositStatusVo){
        return depositService.updateStatus(depositStatusVo);
    }

}

